package com.cykj.eurekaclient.mapping;

import com.cykj.eurekaclient.bean.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BusMapper {


    public int selectCity(@Param(value = "cityname") String cityname);


    public int selectAllBus(@Param(value = "cityid") String cityid,
                            @Param(value = "licensePlate") String licensePlate,
                            @Param(value = "maintainer") String maintainer,
                            @Param(value = "state") long state);

    public List<Bus> selectBusList(RowBounds rowBounds,
                                   @Param(value = "cityid") String cityid,
                                   @Param(value = "licensePlate") String licensePlate,
                                   @Param(value = "maintainer") String maintainer,
                                   @Param(value = "state") long state);

    public int selectFettle(@Param(value = "maintainer") String maintainer);

    public void addBus(@Param(value = "cityid") int cityid,
                       @Param(value = "fettleId") int fettleId,
                       @Param(value = "registrationTime") String registrationTime,
                       @Param(value = "licensePlate") String licensePlate);

    public void updateBus(@Param(value = "fettlerId") int fettlerId,
                          @Param(value = "state") int state,
                          @Param(value = "licensePlate") String licensePlate,
                          @Param(value = "id") long id);

    public int SelectBusState(@Param(value = "busState") String busState);

    public void delBus(@Param(value = "id") long id);

    public void stopBus(@Param(value = "id") long id,
                        @Param(value = "busState") int busState);

    public int selectMaintainNum(@Param(value = "cityId") String cityId,
                                 @Param(value = "licensePlate") String licensePlate);

    public List<Bus> selectMaintaining(@Param(value = "cityId") String cityId);

    public List<Bus> selectAllMaintain(RowBounds rowBounds, @Param(value = "cityId") String cityId,
                                       @Param(value = "licensePlate") String licensePlate);

    public List<RouteInfo> selectClasses();

    public List<RouteTimeNode> getBeginJourney(@Param(value = "routeName") String routeName);

    public void addCarArrange(@Param(value = "beginTime") String beginTime,
                              @Param(value = "routeId") long routeId,
                              @Param(value = "busId") long busId);

    public List<StationInfo> getBusRoute(@Param(value = "routeName") String routeName);

    public long getBusRouteId(@Param(value = "routeName") String routeName);

    public void carReArrange(@Param(value = "id") long id,
                             @Param(value = "busId") long busId);

    // 点击搜索框查询某条线路的所有站点名字
    List<StationInfo> selStationName(String searchInfo);

    // 模糊查询到线路的名字
    List<String> selRouteName(String routeName);

    // 查到某一个区的所有站点信息
    List<StationInfo> getStationListMY(@Param(value = "district") String district);

    // 用起点和终点的站点判断查到相关线路,乘车方案
    List<RouteInfo> getRideScheme(@Param(value = "startStationName") String startStationName, @Param(value = "endStationName") String endStationName);

    // 用站点查到包含此站点的所有线路
    List<RouteInfo> stationInRouteAll(@Param(value = "startStationName") String startStationName);

    // 用站点的名字查到经纬度
    StationInfo useNameGetStationInfo(@Param(value = "stationName") String stationName);

    // 用户上车的起点和下车点的站点所处的线路排序位置来截取某条线路中的一段站点（正方向）
    List<StationInfo> interceptStation(@Param(value = "routeName") String routeName,@Param(value = "upStationSequence") long upStationSequence,@Param(value = "stopStationSequence") long stopStationSequence);

    // 用户上车的起点和下车点的站点所处的线路排序位置来截取某条线路中的一段站点（反方向）
    List<StationInfo> backInterceptStation(@Param(value = "routeName") String routeName,@Param(value = "stopStationSequence") long stopStationSequence,@Param(value = "upStationSequence") long upStationSequence);

}
